package com.simas.info;

import net.rim.device.api.ui.UiApplication;
//import net.rim.device.api.ui.component.Dialog;
//import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;

import com.simas.common.CommonFunction;
import com.simas.common.CustomResources;
import com.simas.screen.XmlShowINFOScreen;

public class CallInfoServlet {
	CustomResources cr = new CustomResources();
	CommonFunction cf = new CommonFunction();
	private String strINFOServlet;
	
	public CallInfoServlet() {
		
	}
	
	// retrieve image
	public String fnRetrieveImageURL(int intHidMode, String strTitleInfo) {
		strINFOServlet = cr.getStrINFOServlet();
		strINFOServlet = strINFOServlet + "?hidMode=" + intHidMode + "&hidInfoTitle=" + strTitleInfo;
		String myURL = cf.fnStringToURL(strINFOServlet);
		//NoWaitProcess nwp = new NoWaitProcess(myURL, "GET", infoScreen);
		return myURL;
	}
	
	// show info screen
	public void fnCallInfoServlet(MainScreen mainScreen, int intHidMode) {
		strINFOServlet = cr.getStrINFOServlet();
		strINFOServlet = strINFOServlet + "?hidMode=" + intHidMode;
		//Dialog.alert("strINFOServlet: " + strINFOServlet);
		String myURL = cf.fnStringToURL(strINFOServlet);
		UiApplication.getUiApplication().popScreen(mainScreen);
		XmlShowINFOScreen xsis = new XmlShowINFOScreen(myURL, intHidMode);
		UiApplication.getUiApplication().pushScreen(xsis);
	}
	
	// show info 
	public void fnCallInfoServlet(MainScreen mainScreen, int intHidMode, String strHurufAwal, String strRecNo, String strMaxNo, String strInfoTitle, int intGetDetail) {
		strINFOServlet = cr.getStrINFOServlet();
		strINFOServlet = strINFOServlet + "?hidMode=" + intHidMode + "&hidHurufAwal=" + strHurufAwal + "&hidRecNo=" + strRecNo + "&hidMaxNo=" + strMaxNo + "&hidInfoTitle=" + strInfoTitle + "&hidGetDetail=" + intGetDetail;
		//Dialog.alert("strINFOServlet: " + strINFOServlet);
		String myURL = cf.fnStringToURL(strINFOServlet);
		UiApplication.getUiApplication().popScreen(mainScreen);
		XmlShowINFOScreen xsis = new XmlShowINFOScreen(myURL, intHidMode);
		UiApplication.getUiApplication().pushScreen(xsis);
	}
}
